import { fetch } from '../fetch' // 引用fetch.js
// import { filterEmptyProperty } from '../utils'
/* eslint-disable */
export function getActivityState ({activityId}) { // 登录
  let data = {activityId}
  return fetch({
    url: 'littlefinger/activity/getActivityState',
    method: 'get', // 请求方法
    params: data
  })
}

export function getAccessTokenAction ({appid, secret, code, grant_type}) {
  let data = {appid, secret, code, grant_type}
  return fetch({
    url: '/sns/oauth2/access_token',
    method: 'get', // 请求方法
    params: data
  })
}

export function getUserInfoAction ({access_token, openid, lang}) {
  let data = {access_token, openid, lang}
  return fetch({
    url: '/sns/userinfo',
    method: 'get', // 请求方法
    params: data
  })
}

export function storeUserInfoAction ({openid, nickname, userInfo}) {
  var data = new FormData()
  data.append('openid', openid)
  data.append('nickname', nickname)
  data.append('userInfo', userInfo)
  return fetch({
    url: '/littlefinger/littleGame/uploadUserInfo',
    method: 'post', // 请求方法
    data: data
  })
}
export function getOpenIdAction ({code}) {
  var data = {code}
  return fetch({
    url: '/littlefinger/littleGame/getOpenId',
    method: 'get', // 请求方法
    params: data
  })
}
